<?php 
$arr = glob('./upload/*');
$k = $_GET['id'];
$file=$arr[$k];
echo $file;
if(is_dir($file) ) echo '<script>window.location.href="./index.php"</script>';
//二进制文件
header("Content-type:application/octet-stream");
//获得文件名
$fileName = basename($file);
//下载窗口中显 示的文件名
header("Content-Disposition:attachment;filename={$fileName}");
//文件尺寸单位
header("Content-ranges:bytes");
//文件大小
header("Content-length:".filesize($file));
//读出文件内容
readfile($file);





 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 <head>
 	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
 	<title>Document</title>
 	<link rel="stylesheet" href="css/index.css" />
 </head>
 <body>


 	

 	
 	
 	
 	
 	
 	
 	
 </body>
 </html>